﻿using System;
using System.Collections.Generic;
using System.Configuration;

namespace Alex.Library.Log.Configuration
{
    /// <summary>
    /// 地址元素集合
    /// </summary>
    public sealed class AddressElementCollection : ConfigurationElementCollection
    {
        /// <summary>
        /// 创建新元素
        /// </summary>
        /// <returns></returns>
        protected override ConfigurationElement CreateNewElement()
        {
            return new AddressElement();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((AddressElement)element).Value;
        }

        /// <summary>
        /// 获取指定集合类型
        /// </summary>
        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.BasicMap;
            }
        }

        /// <summary>
        /// 集合元素名称
        /// </summary>
        protected override string ElementName
        {
            get
            {
                return "address";
            }
        }
    }
}
